<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("admin.ad.edit")}</title>


<link href="${base}/resources/admin/css/amazeui.css" rel="stylesheet" type="text/css" />
<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
    .ava{
        width:40px;
        height: 40px;
        cursor: pointer;
    }
</style>
</head>
<body>
<div class="path">
    <a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; ${message("admin.ad.edit")}
</div>
<form id="inputForm" action="update.htm" method="post">
    <input type="hidden" name="id" value="${ad.id}" />
    <table class="input">
        <tr>
            <th>
                ${message("Ad.adPosition")}:
            </th>
            <td>
                <select name="adPositionId">
                    [#list adPositions as adPosition]
                        <option value="${adPosition.id}"[#if adPosition == ad.adPosition] selected="selected"[/#if]>${adPosition.name} 【${adPosition.description}】</option>
                    [/#list]
                </select>
            </td>
        </tr>
        <tr>
            <th>
                广告图:
            </th>
            <td>
                <span class="fieldSet">
                    <input type="text" name="path" class="text" value="${ad.path}" maxlength="200" title="${message("admin.product.imageTitle")}" />
                    <input type="button" id="browserButton" class="button" value="${message("admin.browser.select")}" />
                [#if ad.path??]
                    <img src="${ad.path}" class="browserImage ava"/>
                [/#if]
                </span>
            </td>
        </tr>
        [#--<tr>--]
            [#--<th>--]
                [#--${message("Ad.beginDate")}:--]
            [#--</th>--]
            [#--<td>--]
                [#--<input type="text" id="beginDate" name="beginDate" class="text Wdate" value="[#if ad.beginDate??]${ad.beginDate?string("yyyy-MM-dd HH:mm:ss")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss', maxDate: '#F{$dp.$D(\'endDate\')}'});" />--]
            [#--</td>--]
        [#--</tr>--]
        [#--<tr>--]
            [#--<th>--]
                [#--${message("Ad.endDate")}:--]
            [#--</th>--]
            [#--<td>--]
                [#--<input type="text" id="endDate" name="endDate" class="text Wdate" value="[#if ad.endDate??]${ad.endDate?string("yyyy-MM-dd HH:mm:ss")}[/#if]" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss', minDate: '#F{$dp.$D(\'beginDate\')}'});" />--]
            [#--</td>--]
        [#--</tr>--]
        <tr>
            <th>
                老师:
            </th>
            <td>
                [#--${ad.teacherId!""}--]
                    <select name="teacherId" data-am-selected="{searchBox: 1}" >
                    [#list teachers as teacher ]
                        [#if teacher.type="teacher"]
                            <option value="${teacher.id}" [#if teacher.id==ad.teacherId] selected="selected" [/#if]>${teacher.username}[#if teacher.name]（${teacher.name}）[/#if]</option>
                        [/#if]
                    [/#list]
                    </select>
            </td>
        </tr>
        [#--<tr>--]
            [#--<th>--]
                [#--${message("admin.common.order")}:--]
            [#--</th>--]
            [#--<td>--]
                [#--<input type="text" name="order" class="text" value="${ad.order}" maxlength="9" />--]
            [#--</td>--]
        [#--</tr>--]
        <tr>
            <th>
                &nbsp;
            </th>
            <td>
                <input type="submit" class="button" value="${message("admin.common.submit")}" />
                <input type="button" class="button" value="${message("admin.common.back")}" onclick="location.href='list.htm'" />
            </td>
        </tr>
    </table>
</form>
</body>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/amazeui.min.js"></script>
<script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
<script type="text/javascript" src="${base}/resources/admin/datePicker/WdatePicker.js"></script>
<script type="text/javascript">
    $().ready(function() {

        var $inputForm = $("#inputForm");
        var $browserButton = $("#browserButton");
        $browserButton.browser();
    [@flash_message /]
    // 表单验证
        $inputForm.validate({
            rules: {
                adPositionId: "required",
                order: "digits"
            }
        });

        $(".ava").on("click", function() {
            window.open($(this).attr("src"));
        })

    });
</script>
</html>